/*
 * UnaryNotOperatorAst.cpp
 *
 *  CreNotd on: 1 Nov 2010
 *      Author: ph1109
 */

#include <MAlice/Ast/UnaryNotOperatorAst.h>
#include <MAlice/Parser/location.hh>

namespace MAlice
{

UnaryNotOperatorAst::UnaryNotOperatorAst(location loc, ExpressionAst* lhs) :
	UnaryOperatorAst(loc, "~", lhs)
{
	MALICE_TRACE;
}

UnaryNotOperatorAst::~UnaryNotOperatorAst()
{
	MALICE_TRACE;

}

llvm::Value* UnaryNotOperatorAst::generate()
{
	MALICE_TRACE;
	Value* LHS = getLHS()->generate();
	Builder* builder = MAlice::Codegen::get()->getBuilder();
	return builder->CreateNot(LHS, getName(LHS));
}

}


